home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_serlib.sit
/
Serial Library Source Code
/
error.c
< prev
next >
Wrap
Text File
|
1989-07-27
|
2KB
|
117 lines
/***********************************************************************/
/*
/* error.c
/* by Atul Butte
/* Copyright ⌐ 1989 by Microsoft Corporation
/* All Rights Reserved
/*
/* version 1.0
/*
/*
/* This routine provides standard error display functions.
/*
/***********************************************************************/
/***********************************************************************/
/*
/* D E F I N E S
/*
/***********************************************************************/
#define hNIL 0L
#define pNIL 0L
/* if you are using Think C, remove the following line */
#define MPW
#ifndef MPW
#define THINK
#endif
/***********************************************************************/
/*
/* I N C L U D E S
/*
/***********************************************************************/
#ifdef MPW
#include <Types.h>
#include <Quickdraw.h>
#include <Fonts.h>
#include <Serial.h>
#include <Files.h>
#include <ToolUtils.h>
#include <OSUtils.h>
#include <Events.h>
#include <Windows.h>
#include <Fonts.h>
#include <TextEdit.h>
#endif
#include "error.h"
void display_string( pstMsg )
char *pstMsg;
{
Rect rectBounds;
Rect rectIcon;
Rect rectText;
WindowPtr pwindNew;
GrafPtr Tport;
EventRecord event;
SetRect( &rectBounds, 0, 0, 340, 160 );
SetRect( &rectIcon, 20, 20, 52, 52 );
SetRect( &rectText, 20, 64, 320, 140 );
OffsetRect( &rectBounds, 100, 60 );
pwindNew = NewWindow( pNIL, &rectBounds, "\pLibrary Error", true, dBoxProc, (WindowPtr) -1, false, 0L );
if( pwindNew == pNIL ) {
SysBeep( 1 );
SysBeep( 1 );
}
GetPort( &Tport );
SetPort( pwindNew );
PlotIcon( &rectIcon, GetIcon( 1 ) );
TextFont( systemFont );
TextSize( 12 );
MoveTo( 65, 34 );
DrawString( "\pLibrary Error!" );
MoveTo( 65, 50 );
DrawString( "\pClick the mouse to continue." );
TextBox( pstMsg + 1, (long) *pstMsg, &rectText, teJustLeft );
while( !Button() );
while( WaitMouseUp() );
GetNextEvent( mDownMask, &event );
SetPort( Tport );
DisposeWindow( pwindNew );
}
void return_string( pstBuff, wError )
register char *pstBuff;
char wError;
{
register char *pstLength = pstBuff;
*pstLength = 6;
pstBuff++;
*pstBuff = 'E';
pstBuff++;
*pstBuff = 'r';
pstBuff++;
*pstBuff = 'r';
pstBuff++;
*pstBuff = ' ';
pstBuff++;
*pstBuff = '-';
pstBuff++;
wError = -wError;
if( wError > 9 ) {
(*pstLength)++;
*pstBuff = '0' + wError / 10;
wError = wError % 10;
*pstBuff++;
}
*pstBuff = wError + '0';
}